package com.mida.bms.report.api;

import com.mida.bms.report.entity.DocStructTemplateAuth;
import com.mida.bms.report.entity.DocStructTemplateAuthSpace;
import com.mida.bms.report.vo.DocStructTemplateAuthBatchVo;
import com.mida.bms.report.vo.DocStructTemplateAuthSpaceVo;
import com.mida.bms.report.vo.PageResultVo;
import com.mida.tool.common.result.ActionResult;
import com.mida.tool.common.result.ListResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.DependsOn;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Description: 结构化模板授权空间feign接口
 * @Author: wang xiao le
 * @Date: 2021/6/16 10:42
 **/
@DependsOn("loadFromDatabasePropertyConfig")
@FeignClient(name = "docStructTemplateAuthSpaceApi", url = "bms.report.feign.url")
public interface DocStructTemplateAuthSpaceApi {


    /**
     * 1、添加结构化模板报告授权空间
     *
     * @param docStructTemplateAuthSpaceVo   结构化模板报告授权空间Vo
     * @return null
     */
    @PostMapping(value = "/docStructTemplateAuth/add",consumes = MediaType.APPLICATION_JSON_VALUE)
    ActionResult add(@RequestBody DocStructTemplateAuthSpaceVo docStructTemplateAuthSpaceVo);

    /**
     * 2、更新结构化模板报告授权空间
     *
     * @param docStructTemplateAuthSpaceVo
     * @return
     */
    @PostMapping(value = "/docStructTemplateAuth/update",consumes = MediaType.APPLICATION_JSON_VALUE)
     ActionResult update(@RequestBody DocStructTemplateAuthSpaceVo docStructTemplateAuthSpaceVo);

    /**
     * 3、删除结构化模板报告授权空间
     *
     * @param stTempAuthSpSoid 结构化模板报告授权空间soid
     * @return null
     */
    @DeleteMapping(value = "/docStructTemplateAuth/delete")
    ActionResult delete(@RequestParam(value = "stTempAuthSpSoid") long stTempAuthSpSoid);

    /**
     * 5、分页查询结构化模板报告授权空间
     * @param searChData  搜索关键字
     * @param currentPage 第几页
     * @param pageSize    每页显示数
     * @return
     */
    @ApiOperation(value = "分页查询结构化模板报告授权空间", notes = "分页查询结构化模板报告授权空间")
    @PostMapping(value = "/docStructTemplateAuth/findPage",produces = { "application/json;charset=UTF-8" })
    ListResult<PageResultVo<DocStructTemplateAuthSpaceVo>> findPage(@RequestParam(value = "searchData") String searChData,
                                                                    @RequestParam(value = "currentPage") Long currentPage,
                                                                    @RequestParam(value = "pageSize") Long pageSize);

    /**
     * 6、结构化模板报告授权空间名称重复性校验
     */
    @GetMapping(value = "/docStructTemplateAuth/checkName")
    ActionResult checkName(@RequestParam(value = "name", required = true) String name,
                           @RequestParam(value = "stTempAuthSpSoid", required = false) Long stTempAuthSpSoid);

    /**
     * 7、更改结构化模板报告授权空间状态
     *
     * @param stTempAuthSpSoid 授权空间soid
     * @param status       状态soid
     * @return
     */
    @GetMapping("/docStructTemplateAuth/updateStatus")
    ActionResult updateStatus(@RequestParam(value = "status", required = true) Long status,
                               @RequestParam(value = "stTempAuthSpSoid", required = false) Long stTempAuthSpSoid);

    /**
     * 8、结构化模板报告授权空间下拉(查询所有授权空间)
     * @return
     */
    @GetMapping("/docStructTemplateAuth/findAll")
    ListResult<List<DocStructTemplateAuthSpace>> findAll(@RequestParam(value = "searchData") String searChData,@RequestParam(value = "hospitalSoid") Long hospitalSoid);

    /**
     * 9、根据授权空间soid查询授权空间基本信息
     * @param stTempAuthSpSoid 授权空间soid
     * @return 授权空间基本信息
     */
    @GetMapping("/docStructTemplateAuth/selectByAuthSpSoid")
    @ResponseBody
    ListResult<DocStructTemplateAuthSpaceVo> selectByAuthSpSoid(@RequestParam(value = "stTempAuthSpSoid") long stTempAuthSpSoid);

    /**
     * 10. 批量插入模板授权空间业务处理
     * @param
     * @return
     */
    @PostMapping(value = "/docStructTemplateAuth/addDocStructTemplateAuthBatch",consumes = MediaType.APPLICATION_JSON_VALUE)
    ActionResult addDocStructTemplateAuthBatch(@RequestBody List<DocStructTemplateAuth> listDocStructTemplateAuth);
}
